-- Contador de 0's ala izquierda

library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_arith.all;

entity contador is
port(a: in std_logic_vector(7 downto 0);
     output: out std_logic_vector(7 downto 0));
end contador;

architecture behavior of contador is
begin
contar: process(a)
begin
if(a(6) = '0') then
  if(a(5) = '0') then
     if(a(4) = '0') then
        if(a(3) = '0') then
           if(a(2) = '0') then
             if(a(1) = '0') then
                if(a(0) = '0') then
                   output <= "00000111";
                else
                   output <= "00000110";
                end if;
             else
                output <= "00000101";                 
             end if;
            else
              output <= "00000100";
            end if;
         else
            output <= "00000011";
         end if;
     else
        output <= "00000010";
     end if;
  else
      output <= "00000001";
  end if;
else
  output <= "00000000";
end if;
end process contar;
end behavior;
 